#ifndef MAINSCENE_H
#define MAINSCENE_H

#include <QWidget>
#include <QTimer>
#include "map.h"
#include "heroplane.h"
#include "bullet.h"
#include "enemyplane.h"
#include "enemyplane2.h"
#include "enemyplane3.h"
#include <QDialog>
#include "over.h"

namespace Ui {
class MainScene;
}
class MainScene : public QWidget
{
    Q_OBJECT

public:
    MainScene(QWidget *parent = nullptr);
    ~MainScene();

    int score=0;
    //初始化场景
    void initScene();

    //开始游戏
    void playGame();

    //更新所有游戏中元素坐标
    void updatePosition();

    //绘制到屏幕中  (函数名称不可改)
    void paintEvent(QPaintEvent *);

    //重新鼠标移动事件
    void mouseMoveEvent(QMouseEvent *);
    void MouseTracking();

    //地图对象
    map m_map;

    //飞机对象
    HeroPlane m_hero;

    //定时器
    QTimer m_Timer;

    //敌机出场
    void enemyToScene();
    void enemyToScene2();
    void enemyToScene3();

    //敌机数组
    EnemyPlane m_enemy[ENEMY_NUM];
    EnemyPlane2 m_enemy2[ENEMY_NUM2];
    EnemyPlane3 m_enemy3[ENEMY_NUM3];

    //敌机出场间隔
    int m_recorder;
    int m_recorder2;
    int m_recorder3;

    //碰撞检测
    void collisionDetection();

    //死亡条件
    bool gameover;

    over *rego=NULL;



};
#endif // MAINSCENE_H
